﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;

using NUnit.Framework;

namespace Space_Conquest
{
    class UnitTesting
    {


        #region Start Testing / List of Tests to Run

        /// <summary>
        /// Start Testing, Select which tests to run, and comment out others
        /// </summary>
        public static void StartTesting()
        {

            //ARGBTest();
            InputManagerTest();

        }
        
        #endregion

        #region Unit Test Implementations


        #region ARGB Color Function Test
        
        /// <summary>
        /// Tests the custom ARGB color function
        /// </summary>
        [Test]
        public static void ARGBTest()
        {

            Assert.AreEqual(Helpers.ARGB(255, 0, 0, 255), Color.Blue.ToArgb());
            Assert.AreEqual(Helpers.ARGB(255, 0, 255, 0), Color.Lime.ToArgb());
            Assert.AreEqual(Helpers.ARGB(255, 255, 0, 0), Color.Red.ToArgb());

            Console.WriteLine("Finished ARGB Test.");

        }

        #endregion
        #region InputManagerTest

        /// <summary>
        /// Class used to test InputManager
        /// </summary>
        class InputTester : IInput
        {

            public InputTester(string name)
            {
                this.name = name;
            }

            private string name;

            public bool MouseDown(MouseButtons button, int x, int y)
            {
                Console.WriteLine("--- MouseDown Event: " + name + " ---");
                return true;
            }

            public bool MouseUp(MouseButtons button, int x, int y)
            {
                Console.WriteLine("--- MouseUp Event: " + name + " ---");
                return false;
            }

            public bool MouseMove(int x, int y)
            {
                Console.WriteLine("--- MouseMove Event: " + name + " ---");
                return false;
            }

            public bool KeyDown(Keys key, bool shift)
            {
                Console.WriteLine("--- KeyDown Event: " + name + " ---");
                return false;
            }

            public bool KeyUp(Keys key, bool shift)
            {
                Console.WriteLine("--- KeyUp Event: " + name + " ---");
                return false;
            }

        }

        /// <summary>
        /// Tests the functionality of the Input Manager
        /// </summary>
        [Test]
        public static void InputManagerTest()
        {

            InputManager im = new InputManager();

            im.Add(new InputTester("I 1"));
            im.Add(new InputTester("I 2"));
            im.Add(new InputTester("I 3"));
            im.Add(new InputTester("I 4"));

            im.KeyDown(Keys.A,true);
            im.MouseDown(MouseButtons.Left, 0, 0);

        }

        #endregion


        #endregion



    }
} 
